package com.stud.service;

import com.stud.exception.ValidationException;
import com.stud.rmi.Account;
import com.stud.rmi.Client;
import com.stud.rmi.Service;

import java.rmi.RemoteException;

public class ServiceWrapper {

    private final Service service;

    public ServiceWrapper(Service service) {
        this.service = service;
    }

    public Account getAccount(Client client) {
        try {
            return service.getAccount(client);
        } catch (RemoteException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            return null;
        }
    }

    public void saveClient(Client client) {
        try {
            service.saveClient(client);
        } catch (RemoteException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }

    public void deleteClient(Client client) throws ValidationException {
        try {
            service.deleteClient(client);
        } catch (RemoteException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }
}
